package blackjack.android;

import java.util.ArrayList;
import java.util.Random;

import android.util.StringBuilderPrinter;
import android.widget.Toast;
import android.app.Activity;
import android.content.res.Resources;

public class Deck
{
	public ArrayList<Card> m_deck;
	public ArrayList<Card>newdeck;
	
	public Deck()
	{
		
		m_deck = new ArrayList<Card>();
		

		for (int suit = 0; suit < 4; suit++)
		{
			for (int rank = 0; rank < 13; rank++)
			{
				Card card = new Card(suit, rank);
				m_deck.add(card);
			}
		}
	}

	public void shuffle()
	{
		Random rnd = new Random(System.currentTimeMillis());
		
		ArrayList<Card> newdeck = new ArrayList<Card>();
		
		for (int i = 51; i > 0; i--)
		{
			int random = rnd.nextInt(i);
			newdeck.add(m_deck.get(random));
			m_deck.remove(random);
		}
		newdeck.add(m_deck.get(0));
		m_deck.remove(0);
		
		m_deck = newdeck;
		
	
	}
	
}